<?php

namespace Modules\Captcha\Http\Controllers;

use App\Http\Controllers\ApiBaseController;
use Modules\Captcha\Http\Requests\CaptchaRequest;
use Modules\Captcha\Services\CaptchaService;

class CaptchaController extends ApiBaseController
{
    protected ?array $except = ['captcha', 'verify'];

    /**
     * 说明：获取图片验证码
     *
     * @return
     * @param   type
     * @author  daixinguo (daixinguo57@163.com)
     */
    public function captcha($uuid, CaptchaRequest $request)
    {
        $data = CaptchaService::makeCaptcha($uuid, $request->all());
        return $this->success($data);
    }

    /**
     * 说明：验证图片验证码
     *
     * @return
     * @param   type
     * @author  daixinguo (daixinguo57@163.com)
     */
    public function verify($uuid, CaptchaRequest $request)
    {
        $data = CaptchaService::verifyCaptcha($uuid, $request->all());
        return $this->success($data);
    }
}
